
/****** Object:  Table [dbo].[Address]    Script Date: 07/02/2011 20:30:04 ******/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Address_Persons]') AND parent_object_id = OBJECT_ID(N'[dbo].[Address]'))
ALTER TABLE [dbo].[Address] DROP CONSTRAINT [FK_Address_Persons]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_Address_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[Address] DROP CONSTRAINT [DF_Address_CreateDate]
END
GO


/****** Object:  Table [dbo].[PersonsExpired]    Script Date: 07/02/2011 20:30:04 ******/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_PersonsExpired_Persons]') AND parent_object_id = OBJECT_ID(N'[dbo].[PersonsExpired]'))
ALTER TABLE [dbo].[PersonsExpired] DROP CONSTRAINT [FK_PersonsExpired_Persons]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_PersonsExpired_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[PersonsExpired] DROP CONSTRAINT [DF_PersonsExpired_CreateDate]
END
GO



/****** Object:  Table [dbo].[TransactionReceiptDetail]    Script Date: 07/02/2011 20:31:53 ******/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_TransactionReceiptDetail_DonationPlace]') AND parent_object_id = OBJECT_ID(N'[dbo].[TransactionReceiptDetail]'))
ALTER TABLE [dbo].[TransactionReceiptDetail] DROP CONSTRAINT [FK_TransactionReceiptDetail_DonationPlace]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_TransactionReceiptDetail_DonationAccounts]') AND parent_object_id = OBJECT_ID(N'[dbo].[TransactionReceiptDetail]'))
ALTER TABLE [dbo].[TransactionReceiptDetail] DROP CONSTRAINT [FK_TransactionReceiptDetail_DonationAccounts]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_TransactionReceiptDetail_Transactions]') AND parent_object_id = OBJECT_ID(N'[dbo].[TransactionReceiptDetail]'))
ALTER TABLE [dbo].[TransactionReceiptDetail] DROP CONSTRAINT [FK_TransactionReceiptDetail_Transactions]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_TransactionReceiptDetail_PostalModes]') AND parent_object_id = OBJECT_ID(N'[dbo].[TransactionReceiptDetail]'))
ALTER TABLE [dbo].[TransactionReceiptDetail] DROP CONSTRAINT [FK_TransactionReceiptDetail_PostalModes]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_TransactionReceiptDetail_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[TransactionReceiptDetail] DROP CONSTRAINT [DF_TransactionReceiptDetail_CreateDate]
END
GO


/****** Object:  Table [dbo].[Transactions]    Script Date: 07/02/2011 20:32:41 ******/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Transactions_TransactionModes]') AND parent_object_id = OBJECT_ID(N'[dbo].[Transactions]'))
ALTER TABLE [dbo].[Transactions] DROP CONSTRAINT [FK_Transactions_TransactionModes]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Transactions_Persons]') AND parent_object_id = OBJECT_ID(N'[dbo].[Transactions]'))
ALTER TABLE [dbo].[Transactions] DROP CONSTRAINT [FK_Transactions_Persons]
GO

IF  EXISTS (SELECT * FROM sys.check_constraints WHERE object_id = OBJECT_ID(N'[dbo].[CK_TransactionAmount]') AND parent_object_id = OBJECT_ID(N'[dbo].[Transactions]'))
ALTER TABLE [dbo].[Transactions] DROP CONSTRAINT [CK_TransactionAmount]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_Transactions_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[Transactions] DROP CONSTRAINT [DF_Transactions_CreateDate]
END
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Transactions_Address]') AND parent_object_id = OBJECT_ID(N'[dbo].[Transactions]'))
ALTER TABLE [dbo].[Transactions] DROP CONSTRAINT [FK_Transactions_Address]
GO

/****** Object:  Table [dbo].[Persons]    Script Date: 07/02/2011 20:29:31 ******/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_Persons_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[Persons] DROP CONSTRAINT [DF_Persons_CreateDate]
END
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Persons_Address]') AND parent_object_id = OBJECT_ID(N'[dbo].[Persons]'))
ALTER TABLE [dbo].[Persons] DROP CONSTRAINT [FK_Persons_Address]
GO


/****** Object:  Table [dbo].[DonationAccounts]    Script Date: 07/02/2011 20:33:23 ******/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DonationAccounts_DonationPlace]') AND parent_object_id = OBJECT_ID(N'[dbo].[DonationAccounts]'))
ALTER TABLE [dbo].[DonationAccounts] DROP CONSTRAINT [FK_DonationAccounts_DonationPlace]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_DonationAccounts_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[DonationAccounts] DROP CONSTRAINT [DF_DonationAccounts_CreateDate]
END
GO



/****** Object:  Table [dbo].[DonationPlace]    Script Date: 07/02/2011 20:34:16 ******/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_DonationPlace_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[DonationPlace] DROP CONSTRAINT [DF_DonationPlace_CreateDate]
END
GO


/****** Object:  Table [dbo].[TransactionModes]    Script Date: 07/02/2011 20:34:53 ******/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_TransactionModes_CreateDate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[TransactionModes] DROP CONSTRAINT [DF_TransactionModes_CreateDate]
END
GO


/****** Drop the tables    Script Date: 07/02/2011 20:35:28 ******/

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Persons]') AND type in (N'U'))
DROP TABLE [dbo].[Persons]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PersonsExpired]') AND type in (N'U'))
DROP TABLE [dbo].[PersonsExpired]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Address]') AND type in (N'U'))
DROP TABLE [dbo].[Address]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Transactions]') AND type in (N'U'))
DROP TABLE [dbo].[Transactions]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TransactionReceiptDetail]') AND type in (N'U'))
DROP TABLE [dbo].[TransactionReceiptDetail]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TransactionModes]') AND type in (N'U'))
DROP TABLE [dbo].[TransactionModes]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DonationPlace]') AND type in (N'U'))
DROP TABLE [dbo].[DonationPlace]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PostalModes]') AND type in (N'U'))
DROP TABLE [dbo].[PostalModes]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DonationAccounts]') AND type in (N'U'))
DROP TABLE [dbo].[DonationAccounts]
GO

